/**     
 * @Title: SpringBeanAware.java   
 * @Package me.xxy.mq.demo   
 * @Description: TODO
 * @author weiwei 
 * @date 2018年5月30日 下午5:35:39   
 * @version V1.0     
 */
package me.xxy.mq.demo;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

/**
 * @ClassName: SpringBeanAware
 * @Description: TODO
 * @author weiwei
 * @date 2018年5月30日 下午5:35:39
 * 
 */
public class SpringBeanAware implements ApplicationContextAware {

	private static ApplicationContext applicationContext;

	/*** bean初始化时会被调用 **/
	public void setApplicationContext(ApplicationContext appContext) throws BeansException {
		applicationContext = appContext;
	}

	public static Object getBean(String name) {
		return applicationContext.getBean(name);
	}
}
